<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Environment,java.util.ArrayList,com.ejoysoft.common.Constants,com.ejoysoft.wlanyz.system.SysUserUnit,com.ejoysoft.common.exception.NoRightException" %>
<%@ include file="../include/jsp/head.jsp"%>
<%
if(!globa.userSession.hasRight("40010"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 

String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
int width = 1150;
int height = 350;


%>
<% 
    //初始化
   	Environment  resultsshow=null;
    Environment obj=new Environment(globa);
    //拿到转过来的城市名
    String  strCity = ParamUtil.getString(request,"strCity","");
    //查询条件

    String  strStartTime = ParamUtil.getString(request,"strStartTime","");
    String  strEndTime = ParamUtil.getString(request,"strEndTime","");
    String  strHotPotName = ParamUtil.getString(request,"strHotPotName","").trim();
    globa.enviromentCity = strCity;
    globa.enviromentHotPotName = strHotPotName;
    globa.enviromentStartTime = strStartTime;
    globa.enviromentEndTime = strEndTime;
	String tWhere=" where 1 = 1 and c.strid = b.strhotpotname and b.strtaskid = a.strtaskid and d.strhotspot = c.strid  and a.strcommunityid = e.strcommid  ";
	 if(!strStartTime.equals("")&&!strEndTime.equals("")){
	 if(strStartTime.compareTo(strEndTime)>0)
       {
          out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
        } 
	}
	
	 if(!strCity.equals("")){
     tWhere += " and c.strCity LIKE '%"+ strCity +"%'";
    }
	if(!strHotPotName.equals("")){
     tWhere += " and c.strhotpotname LIKE '%"+ strHotPotName +"%'";
    }
	 
	//记录总数
	int intAllCount=obj.getCount(tWhere,strStartTime,strEndTime);
	//System.out.println(intAllCount+"+++++++++++++++++++++");
	//当前页
	int intCurPage=globa.getIntCurPage();
	//每页记录数
	int intPageSize=globa.getIntPageSize();
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集
	Vector<Environment> vctObj=obj.list(tWhere,intStartNum,intPageSize,strStartTime,strEndTime);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
	
	ArrayList<String> cityList = obj.returnCity("");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script src="../jquerytable/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script language="javascript">

 function showAc(){
   frm.action = "ten_list2.jsp"; 
	frm.submit();
 }
 
 


function clkOn(){
	frm.action="ten_list.jsp";
	frm.submit();
}
function clkOn2(){
	frm.action="ten_list2.jsp";
	frm.submit();
} 

//导出数据
function export_sbm(page){ 
  
  frm.action="wen_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";//当前页
  document.getElementById("exportContent").value = page;
  frm.submit();
  
 } 
 
  function check(){
          var checkboxs = document.getElementsByName("checkbox");
          var indexs="";
          var flag=1;
          for(var i=0;i<checkboxs.length;i++){
               if(checkboxs[i].checked == true){
                	if(flag==1){
               			indexs=indexs+checkboxs[i].value;
                		flag=0;
                	}
               	else{
                		indexs=indexs+','+checkboxs[i].value;
                	}
               }
          } 
           var temp = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'"+
			" codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'"+
			" width='100%' height='100%' id='ie_chart' align='middle'>"+
			" <param name='allowScriptAccess' value='always' />"+
			" <param name='movie'"+
			" value='<%=url%>/environment/open-flash-chart.swf?width=1150&height=350&data=<%=url%>/environment/ten_index.jsp?indexs="+indexs+"&random=<%=Math.random()%>' />" +
			" <param name='quality' value='high' />"+
			" <param name='bgcolor' value='#FFFFFF' />"+
			" <embed src='<%=url%>/environment/open-flash-chart.swf?data=<%=url%>/environment/ten_index.jsp' quality='high'"+
			" bgcolor='#FFFFFF' width='<%=width%>' height='<%=height%>'"+
			" name='chart' align='middle' allowScriptAccess='always' "+
			" type='application/x-shockwave-flash'"+
			" pluginspage='http://www.macromedia.com/go/getflashplayer'" +
			" id='chart'/>"+
			" </object>";
           //alert(temp);
           $("#imageDiv").html(temp);
         //  $("#imageDiv").html("HELLS");
           //frm.submit(); 
           
    }        
           
    //} 
</script>

<style>
.tab1{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
.tab3{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
.tab2{ width:123px; height:27px; background:url(../images/tab_2.jpg); color:#666666; text-align:center;line-height:25px;line-height:26px;  border-right:1px solid #32a4ea; line-height:26px;}

A {text-decoration: NONE} 
</style>
</head>


<body  >
<form id=frm name="frm" method=post action="wen_list2.jsp"> 
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value=""/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">网络环境分析</font> &gt; TD网络环境分析</td>
  </tr>
</table>
<table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" width="20%" height="40">地市(<span class="STYLE1">*</span>)
          <select name="strCity" id="strCity" class="sel1" style="width:100px" >
          <option value="">--请选择--</option>
			 <% for (int j = 0; j <  cityList.size(); j++) {
					String city = cityList.get(j);
					String selected = "";
					if(city !=null){
					if(strCity!= null && strCity.equals(city))
						selected = "selected='selected'";
				%>
				<option value="<%=city%>" <%=selected%>>
					<%=city%>
				</option>
				<%
				}
				}
				%>
          </select></td><td align="left" width="20%" nowrap>
          	二级热点<input type="text" size="20px" id="strHotPotName" name="strHotPotName" value=<%=strHotPotName %>></td>
          
           <td align="right" width="40%" >起止时间(<span class="STYLE1">*</span>)
	          <input  name="strStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strStartTime %>"style="width:100"/>-
	          <input  name="strEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value="<%=strEndTime %>"style="width:100"/>
          </td>
          <td width="%">&nbsp;</td>
        <td><img src="../images/search.jpg" width="58" height="28" onclick="showAc()" style="cursor:hand"/>
        
        </td>
        
        </tr>
      </table></td>
  </tr>
</table>
<td><input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
		 <input id="strCurPage" name="strCurPage" type="hidden" value=""/>
			<input id="exportContent" name="exportContent" type="hidden" value=""/></td>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td width="9%"  height="27" background="../images/tab_2.jpg"  onclick="clkOn()" style="cursor:hand">地市测试数据分析</td>
 <td width="9%"  background="../images/tab_1.jpg"  onclick="clkOn2()" style="cursor:hand">热点测试数据分析</td>

 <td background="../images/tab_2.jpg">&nbsp;</td>
    </tr>
 </table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
 
  <tr>
    
    <td width="7%" class="listtit">地市</td>
    <td width="7%" class="listtit">区县</td>
    <td width="10%" class="listtit">一级热点</td>
    <td width="10%" class="listtit">二级热点</td>
    <td width="10%" class="listtit">AP名称</td>
    <td width="10%" class="listtit">MAC地址</td>
    <td width="7%" class="listtit">LAC</td>
    <td width="7%" class="listtit">CI</td>
    <td width="10%" class="listtit">测试时间</td>
    
    
  </tr>
    <%
            
              for (int i = 0;i < vctObj.size(); i++) {
              String city = "";
              String town = "";
              String dtDate = "";//time
              String oneac = "";//一级热点
              String twoac = "";//二级热点
              String Lac = "";//
              String ap = "";//ap名称
              String mac = "";//mac地址
              String CI = "";//ci
                 
            	Environment obj1 = vctObj.get(i);
            	if(obj1.getStrCity()!=null)city=obj1.getStrCity();
            	if(obj1.getStrTown()!=null)town=obj1.getStrTown();
            	if(obj1.getDtCreatDate()!=null)dtDate=obj1.getDtCreatDate();
            	if(obj1.getStrLac()!=null)Lac=obj1.getStrLac();
            	if(obj1.getStrCI()!=null)CI=obj1.getStrCI();
            	if(obj1.getStrClassOneHP()!=null)oneac=obj1.getStrClassOneHP();
            	if(obj1.getStrHotPotName()!=null)twoac=obj1.getStrHotPotName();
            	if(obj1.getDevice_Name()!=null&&obj1.getStrApMac()!=null) 
            		ap=obj1.getDevice_Name();
            	if(obj1.getStrApMac()!=null) mac=obj1.getStrApMac();
            %>

  <tr>
    
    <td class="listd1"><%=city %>&nbsp;</td>
    <td class="listd1"><%=town %>&nbsp;</td>
    <td class="listd1"><%=oneac %>&nbsp;</td>
    <td class="listd1"><%=twoac %>&nbsp;</td>
    <td class="listd1"><%=ap %>&nbsp;</td>
    <td class="listd1"><%=mac %>&nbsp;</td>
    <td class="listd1"><%=Lac %>&nbsp;</td>
    <td class="listd1"><%=CI %>&nbsp;</td>
    <td class="listd1"><%=dtDate %>&nbsp;</td>
    
   </tr>
             <%
            }
            %>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
     <td width="61%" height="50" valign="bottom">
      <img src="../images/dc.jpg" width="92" height="27" align="absmiddle" onclick="export_sbm('currentPage')" style="cursor:hand"/> <img src="../images/dcall.jpg" width="82" height="27" align="absmiddle" onclick="export_sbm('allPage')" style="cursor:hand"/></td>
    <td width="39%" align="right" valign="bottom">            <!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="bottom" />&nbsp;请选择指标进行对比分析</td>
  </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

   <tr>
   
     <td width="13%" class="listtit"  style="border-left:1px solid #32a4ea;">
     <input type="checkbox" name="checkbox" id="checkbox" value="intPing_Sucrate" onclick="" style="height:12px;" />
    PING成功率</td>
    
   <td width="13%" class="listtit"  style="border-left:1px solid #32a4ea;">
   <input type="checkbox" name="checkbox" id="checkbox" value="intPing_Delay" onclick="" style="height:12px;" />
   PING平均时延</td>
    
   <td width="13%" class="listtit"  style="border-left:1px solid #32a4ea;">
   <input type="checkbox" name="checkbox" id="checkbox" value="intRssi" onclick="" style="height:12px;" />
       信号强度</td>
   <td colspan="2" align="right" height="25">
            <input type="button" name="b_submit" value="查看"  onclick="check()" style="cursor:hand" class="ipt1"/>
            </td>
  </tr>


</table>
<div id=imageDiv>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
	width="<%=width%>" height="<%=height%>" id="ie_chart"
	align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="movie"
		value="<%=url%>/environment/open-flash-chart.swf?width=<%=width%>&height=<%=height%>&data=<%=url%>/environment/ten_index.jsp" />
	<param name="quality" value="high" />
	<param name="bgcolor" value="#FFFFFF" />
	<embed src="<%=url%>/environment/open-flash-chart.swf?data=<%=url%>/environment/ten_index.jsp" quality="high"
		bgcolor="#FFFFFF" width="<%=width%>" height="<%=height%>"
		name="chart" align="middle" allowScriptAccess="sameDomain"
		type="application/x-shockwave-flash"
		pluginspage="http://www.macromedia.com/go/getflashplayer"
		id="chart" />
</object>
</div>

 </form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>